<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>后台登陆</title>

<link rel="stylesheet" type="text/css"
	href="easyUI/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="easyUI/themes/icon.css">
<script type="text/javascript" src="easyUI/jquery.min.js"></script>
<script type="text/javascript" src="easyUI/jquery.easyui.min.js"></script>
</head>
<body>
	<div style="margin: 0 auto; width: 400px;">
		<div style="margin: 20px 0;"></div>
		<div class="easyui-panel" title="登录到后台" style="width: 400px;">
			<div>
				<form id="ff" class="easyui-form" method="post"
					data-options="novalidate:true"
					action="${pageContext.request.contextPath }/AdminLoginServlet">
					<table cellpadding="5">
						<tr>
							<td>邮箱:</td>
							<td><input class="easyui-textbox" type="text"
								name="form_email" data-options="required:true,validType:'email'"></input></td>
						</tr>
						<tr>
							<td>密码:</td>
							<td><input class="easyui-textbox" type="password"
								name="form_password" data-options="required:true"></input></td>
						</tr>
						<tr>
							<td>验证码:${DashBoardVcodeMessage}</td>
							<td><input class="easyui-textbox" type="text" name="Vcode"
								data-options="required:true"></input> <img
								src="${pageContext.request.contextPath }/VCode" /></td>
						</tr>

					</table>
				</form>
				<div style="text-align: center; padding: 5px">
					<a href="javascript:void(0)" class="easyui-linkbutton"
						onclick="submitForm()">登录</a> <a href="javascript:void(0)"
						class="easyui-linkbutton" onclick="clearForm()">清空</a>
				</div>
			</div>
		</div>

	</div>
	<script>
		function submitForm() {
			var d = $("#ff").serialize();

			if (!$("#ff").form('enableValidation').form('validate'))
				return false;

			$.post("${pageContext.request.contextPath }/AdminLoginServlet", d,
					function(result) {
						if (result != 'success') {
							alert(result);
						} else {
							window.location.href = "AdminDashboard.jsp";
						}
					}, "text");
		}
		function clearForm() {
			$('#ff').form('clear');
		}
	</script>

</body>
</html>